package io.renren.modules.service.impl;

import io.renren.modules.entity.UserEntity;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.dao.ExpertDao;
import io.renren.modules.entity.ExpertEntity;
import io.renren.modules.service.ExpertService;


@Service("expertService")
public class ExpertServiceImpl extends ServiceImpl<ExpertDao, ExpertEntity> implements ExpertService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<ExpertEntity> page = this.selectPage(
                new Query<ExpertEntity>(params).getPage(),
                new EntityWrapper<ExpertEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public ExpertEntity queryByUserId(String user_id) {
        ExpertEntity expertEntity = new ExpertEntity();
        expertEntity.setUserId(user_id);
        return baseMapper.selectOne(expertEntity);
    }

}
